<?php

declare(strict_types=1);
/**
 * This file is part of Sws.
 *
 * @link     https://gitee.com/sreeb/sws-dev.git
 * @document https://gitee.com/sreeb/sws-dev.git
 * @contact  https://gitee.com/sreeb/sws-dev.git
 * @license  https://gitee.com/sreeb/sws-dev/blob/master/LICENSE
 */
use sws\route\Route;

require __DIR__ . '/../vendor/autoload.php';

class TestRoute
{
    public function test()
    {
        Route::group('/a', function () {
            Route::get('/b/{id:\d+}/[{n:\d}]', '')->middleware('middleware2');

            Route::group('/b', function () {
                Route::any('/c', '');
            })->middleware('middleware3', 'middleware6');
        })->middleware('middleware1');

        Route::put('/d', '')->middleware('middleware5');
        Route::get('/a/b/', '')->middleware('middleware5');

        \sws\Container::getInstance()->make(Route::class)->parserRoute();

        $a = \sws\Container::getInstance()->make(Route::class)->getRouteTree();

        var_dump(\sws\Container::getInstance()->make(Route::class)->match('GET', '/a/b/1/'));
    }
}

(new TestRoute())->test();
